/*
 * Copyright (C) 2016  Nicola Spanti (RyDroid) <dev@nicola-spanti.info>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */


#ifndef PLANET_WARS_2D_RT_SDL2_SDL_KEYBOARD_H
#define PLANET_WARS_2D_RT_SDL2_SDL_KEYBOARD_H


#include <SDL2/SDL_keyboard.h>
#include "PlanetWars2dRT-core/utils/bool.h"
#include "PlanetWars2dRT-core/utils/c_language.h"


EXTERN_C_BEGIN


static inline
bool
SDL_mod_state_is_ctrl(SDL_Keymod keymod)
{
  return keymod == KMOD_LCTRL || keymod == KMOD_RCTRL;
}

static inline
bool
SDL_mod_state_current_is_ctrl()
{
  return SDL_mod_state_is_ctrl(SDL_GetModState());
}

static inline
bool
SDL_keycode_is_minus(SDL_Keycode keycode)
{
  return keycode == SDLK_MINUS || keycode == SDLK_KP_MINUS;
}

static inline
bool
SDL_keycode_is_plus(SDL_Keycode keycode)
{
  return keycode == SDLK_PLUS || keycode == SDLK_KP_PLUS;
}


EXTERN_C_END


#endif
